<!doctype html>
<html lang="zh-CN">
<head>

    <meta charset="utf-8">
    <meta name="generator" content="Hugo 0.74.1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>在原 Android 工程的基础上构建一个flutter工程 | caijinglong的博客</title>
    <meta property="og:title" content="在原 Android 工程的基础上构建一个flutter工程 - caijinglong的博客">
    <meta property="og:type" content="article">
        
    <meta property="article:published_time" content="2019-01-22T07:50:31&#43;08:00">
        
        
    <meta property="article:modified_time" content="2019-01-22T07:50:31&#43;08:00">
        
    <meta name="Keywords" content="golang,go语言,flutter,caijinglong,java,android,博客,项目管理,python,软件架构,公众号,小程序">
    <meta name="description" content="在原 Android 工程的基础上构建一个flutter工程">
        
    <meta name="author" content="caijinglong">
    <meta property="og:url" content="http://www.kikt.top/posts/flutter/exists/android/">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">

    <link rel="stylesheet" href="/css/normalize.css">
    
        <link rel="stylesheet" href="/css/prism.css">
    
    <link rel="stylesheet" href="/css/style.css">
    <script type="text/javascript" src="//cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>

    

   
    <script>
        (function(){
            var bp = document.createElement('script');
            var curProtocol = window.location.protocol.split(':')[0];
            if (curProtocol === 'https') {
                bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
            }
            else {
                bp.src = 'http://push.zhanzhang.baidu.com/push.js';
            }
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(bp, s);
        })();
    </script>

    
    
</head>

<body>
<header id="header" class="clearfix">
    <div class="container">
        <div class="col-group">
            <div class="site-name ">
                
                    <a id="logo" href="http://www.kikt.top">
                        caijinglong的博客
                    </a>
                
                <p class="description">Android/Flutter开发者，对于golang/python/ios/java 均有所了解</p>
            </div>
            <div>
                <nav id="nav-menu" class="clearfix">
                    <a class="" href="http://www.kikt.top">首页</a>
                    
                    <a  href="http://www.kikt.top/archives/" title="归档">归档</a>
                    
                    <a  href="http://www.kikt.top/contact/" title="接单">接单</a>
                    
                    <a  href="http://www.kikt.top/about/" title="关于">关于</a>
                    
                </nav>
            </div>
        </div>
    </div>
</header>


<div id="body">
    <div class="container">
        <div class="col-group">

            <div class="col-8" id="main">
                <div class="res-cons">
                    <article class="post">
                        <header>
                            <h1 class="post-title">在原 Android 工程的基础上构建一个flutter工程</h1>
                        </header>
                        <date class="post-meta meta-date">
                            2019年1月22日
                        </date>
                        
                        <div class="post-meta meta-category">
                            |
                            
                                <a href="http://www.kikt.top/categories/flutter">flutter</a>
                            
                                <a href="http://www.kikt.top/categories/android">android</a>
                            
                        </div>
                        
                        
                        <div class="post-meta">
                            <span id="busuanzi_container_page_pv">|<span id="busuanzi_value_page_pv"></span><span> 阅读</span></span>
                        </div>
                        
                        <div class="post-content">
                            <p>在 flutter 开发的过程中不可能所有项目都是从零构建</p>
<p>换句话说不是所有项目都是 flutter 为主工程,然后 android/ios 的工程为副工程</p>
<p>大概率会遇到需要将 flutter 作为组件加入到原生项目中, 这种例子典型的就是阿里闲鱼,当然闲鱼团队的实力不是普通的小公司可以比的</p>
<p>所幸的是,flutter 团队提供了一个 <a href="https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps">wiki</a> 用于帮助我们完成这个过程</p>
<h2 id="创建一个-android-工程">创建一个 Android 工程</h2>
<p>使用 Android Studio 创建一个新工程来模拟这个过程,会看这里的普遍都应该是 android 程序员出身,Hello World 工程是肯定会的,不会的话还是<del>回炉</del>加强一下吧</p>
<p>如果你已经有现有工程,肯定是有 VCS 管理的,放心大胆的走出第一步,大不了就删除当前分支嘛,然后你可以跳过这一步,直接看 flutter 的过程</p>
<p><img src="https://gitee.com/kikt-blog/blog-image/raw/master/weibo/844036b9ly1fy2v0jlrgwj209a0dsmxt.jpg" alt="图片"></p>
<h2 id="创建-flutter">创建 Flutter</h2>
<p>这一步仅作为 官方 <a href="https://github.com/flutter/flutter/wiki/Add-Flutter-to-existing-apps#android">wiki</a> Android 部分的参考</p>
<p>我目前使用的是 1.0.0 的发布版</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">Flutter 1.0.0 • channel dev • https://github.com/flutter/flutter.git
Framework • revision 5391447fae <span style="color:#f92672">(</span><span style="color:#ae81ff">11</span> days ago<span style="color:#f92672">)</span> • 2018-11-29 19:41:26 -0800
Engine • revision 7375a0f414
Tools • Dart 2.1.0 <span style="color:#f92672">(</span>build 2.1.0-dev.9.4 f9ebf21297<span style="color:#f92672">)</span>
</code></pre></div><p>wiki 后续可能会被修改,请查看最新的文档去解决</p>
<p>这里要注意,你要在和你现有的 Application 同级的目录来使用</p>
<p>比如你的 Application</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">➜  ExistsApp flutter create -t module my_flutter
Creating project my_flutter...
  my_flutter/.gitignore <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/.idea/libraries/Dart_SDK.xml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/.idea/libraries/Flutter_for_Android.xml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/.idea/modules.xml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/.idea/workspace.xml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/.metadata <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/lib/main.dart <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/my_flutter.iml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/my_flutter_android.iml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/pubspec.yaml <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/README.md <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
  my_flutter/test/widget_test.dart <span style="color:#f92672">(</span>created<span style="color:#f92672">)</span>
Running <span style="color:#e6db74">&#34;flutter packages get&#34;</span> in my_flutter...              7.5s
Wrote <span style="color:#ae81ff">12</span> files.

All <span style="color:#66d9ef">done</span>!
Your module code is in my_flutter/lib/main.dart.

</code></pre></div><p>这里 flutter 工程就创建成功了</p>
<h2 id="打包-aar-文件修改-host-application">打包 aar 文件/修改 host application</h2>
<p>这一步是构建一个 aar 文件</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">cd .android/
./gradlew flutter:assembleDebug
</code></pre></div><p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190121173003.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190121173003.png"></p>
<p>接着修改 setting.gradle 文件</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-groovy" data-lang="groovy">include <span style="color:#e6db74">&#39;:app&#39;</span>                                     <span style="color:#75715e">// assumed existing content
</span><span style="color:#75715e"></span>setBinding<span style="color:#f92672">(</span><span style="color:#66d9ef">new</span> Binding<span style="color:#f92672">([</span>gradle: <span style="color:#66d9ef">this</span><span style="color:#f92672">]))</span>                                 <span style="color:#75715e">// new
</span><span style="color:#75715e"></span>evaluate<span style="color:#f92672">(</span><span style="color:#66d9ef">new</span> File<span style="color:#f92672">(</span>                                                      <span style="color:#75715e">// new
</span><span style="color:#75715e"></span>  settingsDir<span style="color:#f92672">.</span><span style="color:#a6e22e">parentFile</span><span style="color:#f92672">,</span>                                               <span style="color:#75715e">// new
</span><span style="color:#75715e"></span>  <span style="color:#e6db74">&#39;my_flutter/.android/include_flutter.groovy&#39;</span>                          <span style="color:#75715e">// new
</span><span style="color:#75715e"></span><span style="color:#f92672">))</span>
</code></pre></div><p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190121172743.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190121172743.png"></p>
<p>sync 以后 如果有 flutter 说明关联到项目中了
<img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190121173354.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190121173354.png"></p>
<p>接着,将 flutter 设置为 android 的库</p>
<p>加入这个,然后继续同步一下</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-groovy" data-lang="groovy">dependencies <span style="color:#f92672">{</span>
  implementation <span style="color:#a6e22e">project</span><span style="color:#f92672">(</span><span style="color:#e6db74">&#39;:flutter&#39;</span><span style="color:#f92672">)</span>
<span style="color:#f92672">}</span>
</code></pre></div><p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190121173713.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190121173713.png"></p>
<p>能看见的话就说明加入成功了</p>
<p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190121173657.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190121173657.png"></p>
<h2 id="修改-android-工程">修改 android 工程</h2>
<p>activity_main.xml</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-xml" data-lang="xml"><span style="color:#75715e">&lt;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&gt;</span>
<span style="color:#f92672">&lt;android.support.constraint.ConstraintLayout</span> <span style="color:#a6e22e">xmlns:android=</span><span style="color:#e6db74">&#34;http://schemas.android.com/apk/res/android&#34;</span>
    <span style="color:#a6e22e">xmlns:app=</span><span style="color:#e6db74">&#34;http://schemas.android.com/apk/res-auto&#34;</span>
    <span style="color:#a6e22e">xmlns:tools=</span><span style="color:#e6db74">&#34;http://schemas.android.com/tools&#34;</span>
    <span style="color:#a6e22e">android:layout_width=</span><span style="color:#e6db74">&#34;match_parent&#34;</span>
    <span style="color:#a6e22e">android:layout_height=</span><span style="color:#e6db74">&#34;match_parent&#34;</span>
    <span style="color:#a6e22e">tools:context=</span><span style="color:#e6db74">&#34;.MainActivity&#34;</span><span style="color:#f92672">&gt;</span>

    <span style="color:#f92672">&lt;TextView</span>
        <span style="color:#a6e22e">android:id=</span><span style="color:#e6db74">&#34;@+id/tv_text&#34;</span>
        <span style="color:#a6e22e">android:layout_width=</span><span style="color:#e6db74">&#34;wrap_content&#34;</span>
        <span style="color:#a6e22e">android:layout_height=</span><span style="color:#e6db74">&#34;wrap_content&#34;</span>
        <span style="color:#a6e22e">android:text=</span><span style="color:#e6db74">&#34;Hello World!&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintBottom_toBottomOf=</span><span style="color:#e6db74">&#34;parent&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintLeft_toLeftOf=</span><span style="color:#e6db74">&#34;parent&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintRight_toRightOf=</span><span style="color:#e6db74">&#34;parent&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintTop_toTopOf=</span><span style="color:#e6db74">&#34;parent&#34;</span> <span style="color:#f92672">/&gt;</span>

    <span style="color:#f92672">&lt;Button</span>
        <span style="color:#a6e22e">android:id=</span><span style="color:#e6db74">&#34;@+id/bt_to_flutter&#34;</span>
        <span style="color:#a6e22e">android:layout_width=</span><span style="color:#e6db74">&#34;wrap_content&#34;</span>
        <span style="color:#a6e22e">android:layout_height=</span><span style="color:#e6db74">&#34;wrap_content&#34;</span>
        <span style="color:#a6e22e">android:layout_marginTop=</span><span style="color:#e6db74">&#34;8dp&#34;</span>
        <span style="color:#a6e22e">android:text=</span><span style="color:#e6db74">&#34;to Flutter page&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintLeft_toLeftOf=</span><span style="color:#e6db74">&#34;parent&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintRight_toRightOf=</span><span style="color:#e6db74">&#34;parent&#34;</span>
        <span style="color:#a6e22e">app:layout_constraintTop_toBottomOf=</span><span style="color:#e6db74">&#34;@id/tv_text&#34;</span> <span style="color:#f92672">/&gt;</span>

<span style="color:#f92672">&lt;/android.support.constraint.ConstraintLayout&gt;</span>
</code></pre></div><p>MainActivity.java</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#f92672">package</span> top.kikt.addexiststoandroid<span style="color:#f92672">;</span>

<span style="color:#f92672">import</span> android.content.Intent<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> android.os.Bundle<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> android.support.v7.app.AppCompatActivity<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> android.view.View<span style="color:#f92672">;</span>

<span style="color:#66d9ef">public</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">MainActivity</span> <span style="color:#66d9ef">extends</span> AppCompatActivity <span style="color:#f92672">{</span>

    <span style="color:#a6e22e">@Override</span>
    <span style="color:#66d9ef">protected</span> <span style="color:#66d9ef">void</span> <span style="color:#a6e22e">onCreate</span><span style="color:#f92672">(</span>Bundle savedInstanceState<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
        <span style="color:#66d9ef">super</span><span style="color:#f92672">.</span><span style="color:#a6e22e">onCreate</span><span style="color:#f92672">(</span>savedInstanceState<span style="color:#f92672">);</span>
        setContentView<span style="color:#f92672">(</span>R<span style="color:#f92672">.</span><span style="color:#a6e22e">layout</span><span style="color:#f92672">.</span><span style="color:#a6e22e">activity_main</span><span style="color:#f92672">);</span>

        findViewById<span style="color:#f92672">(</span>R<span style="color:#f92672">.</span><span style="color:#a6e22e">id</span><span style="color:#f92672">.</span><span style="color:#a6e22e">bt_to_flutter</span><span style="color:#f92672">).</span><span style="color:#a6e22e">setOnClickListener</span><span style="color:#f92672">(</span><span style="color:#66d9ef">new</span> View<span style="color:#f92672">.</span><span style="color:#a6e22e">OnClickListener</span><span style="color:#f92672">()</span> <span style="color:#f92672">{</span>
            <span style="color:#a6e22e">@Override</span>
            <span style="color:#66d9ef">public</span> <span style="color:#66d9ef">void</span> <span style="color:#a6e22e">onClick</span><span style="color:#f92672">(</span>View v<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
                <span style="color:#75715e">// to flutter activity
</span><span style="color:#75715e"></span>                Intent intent <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> Intent<span style="color:#f92672">(</span>MainActivity<span style="color:#f92672">.</span><span style="color:#a6e22e">this</span><span style="color:#f92672">,</span> MyFlutterActivity<span style="color:#f92672">.</span><span style="color:#a6e22e">class</span><span style="color:#f92672">);</span>
                startActivity<span style="color:#f92672">(</span>intent<span style="color:#f92672">);</span>
            <span style="color:#f92672">}</span>
        <span style="color:#f92672">});</span>
    <span style="color:#f92672">}</span>
<span style="color:#f92672">}</span>
</code></pre></div><p>MyFlutterActivity.java</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#f92672">package</span> top.kikt.addexiststoandroid<span style="color:#f92672">;</span>

<span style="color:#f92672">import</span> android.os.Bundle<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> android.support.v4.app.FragmentActivity<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> android.widget.FrameLayout<span style="color:#f92672">;</span>

<span style="color:#f92672">import</span> io.flutter.facade.Flutter<span style="color:#f92672">;</span>
<span style="color:#f92672">import</span> io.flutter.view.FlutterView<span style="color:#f92672">;</span>

<span style="color:#75715e">/// create 2019/1/22 by cai
</span><span style="color:#75715e"></span>

<span style="color:#66d9ef">public</span> <span style="color:#66d9ef">class</span> <span style="color:#a6e22e">MyFlutterActivity</span> <span style="color:#66d9ef">extends</span> FragmentActivity <span style="color:#f92672">{</span>

    <span style="color:#a6e22e">@Override</span>
    <span style="color:#66d9ef">protected</span> <span style="color:#66d9ef">void</span> <span style="color:#a6e22e">onCreate</span><span style="color:#f92672">(</span>Bundle savedInstanceState<span style="color:#f92672">)</span> <span style="color:#f92672">{</span>
        <span style="color:#66d9ef">super</span><span style="color:#f92672">.</span><span style="color:#a6e22e">onCreate</span><span style="color:#f92672">(</span>savedInstanceState<span style="color:#f92672">);</span>
        FlutterView flutterView <span style="color:#f92672">=</span> Flutter<span style="color:#f92672">.</span><span style="color:#a6e22e">createView</span><span style="color:#f92672">(</span><span style="color:#66d9ef">this</span><span style="color:#f92672">,</span> getLifecycle<span style="color:#f92672">(),</span> <span style="color:#e6db74">&#34;route1&#34;</span><span style="color:#f92672">);</span>
        FrameLayout<span style="color:#f92672">.</span><span style="color:#a6e22e">LayoutParams</span> params <span style="color:#f92672">=</span> <span style="color:#66d9ef">new</span> FrameLayout<span style="color:#f92672">.</span><span style="color:#a6e22e">LayoutParams</span><span style="color:#f92672">(</span>FrameLayout<span style="color:#f92672">.</span><span style="color:#a6e22e">LayoutParams</span><span style="color:#f92672">.</span><span style="color:#a6e22e">MATCH_PARENT</span><span style="color:#f92672">,</span> FrameLayout<span style="color:#f92672">.</span><span style="color:#a6e22e">LayoutParams</span><span style="color:#f92672">.</span><span style="color:#a6e22e">MATCH_PARENT</span><span style="color:#f92672">);</span>
        addContentView<span style="color:#f92672">(</span>flutterView<span style="color:#f92672">,</span> params<span style="color:#f92672">);</span>
    <span style="color:#f92672">}</span>

<span style="color:#f92672">}</span>

</code></pre></div><p>别忘了增加 Activity 的清单文件</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-xml" data-lang="xml"> <span style="color:#f92672">&lt;activity</span> <span style="color:#a6e22e">android:name=</span><span style="color:#e6db74">&#34;.MyFlutterActivity&#34;</span> <span style="color:#f92672">/&gt;</span>
</code></pre></div><h2 id="修改-flutter-工程">修改 flutter 工程</h2>
<p>main.dart</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-dart" data-lang="dart"><span style="color:#66d9ef">import</span> <span style="color:#e6db74">&#39;package:flutter/material.dart&#39;</span>;
<span style="color:#66d9ef">import</span> <span style="color:#e6db74">&#39;dart:ui&#39;</span> <span style="color:#66d9ef">as</span> ui;

<span style="color:#66d9ef">void</span> main() {
  <span style="color:#66d9ef">var</span> routeName <span style="color:#f92672">=</span> ui.window.defaultRouteName;

  <span style="color:#66d9ef">switch</span> (routeName) {
    <span style="color:#66d9ef">case</span> <span style="color:#e6db74">&#34;route1&#34;</span><span style="color:#f92672">:</span>
      runApp(MyApp());
      <span style="color:#66d9ef">break</span>;
    <span style="color:#66d9ef">default</span><span style="color:#f92672">:</span>
      runApp(EmptyWidget());
  }
}

<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">EmptyWidget</span> <span style="color:#66d9ef">extends</span> StatelessWidget {
  <span style="color:#960050;background-color:#1e0010">@</span>override
  Widget build(BuildContext context) {
    <span style="color:#66d9ef">return</span> MaterialApp(
      home: Scaffold(
        body: Center(
          child: Container(
            child: Text(<span style="color:#e6db74">&#34;空路由&#34;</span>),
          ),
        ),
      ),
    );
  }
}

<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">MyApp</span> <span style="color:#66d9ef">extends</span> StatelessWidget {
  <span style="color:#75715e">// This widget is the root of your application.
</span><span style="color:#75715e"></span>  <span style="color:#960050;background-color:#1e0010">@</span>override
  Widget build(BuildContext context) {
    <span style="color:#66d9ef">return</span> MaterialApp(
      title: <span style="color:#e6db74">&#39;Flutter Demo&#39;</span>,
      theme: ThemeData(
        <span style="color:#75715e">// This is the theme of your application.
</span><span style="color:#75715e"></span>        <span style="color:#75715e">//
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// Try running your application with &#34;flutter run&#34;. You&#39;ll see the
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// application has a blue toolbar. Then, without quitting the app, try
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// changing the primarySwatch below to Colors.green and then invoke
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// &#34;hot reload&#34; (press &#34;r&#34; in the console where you ran &#34;flutter run&#34;,
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// or press Run &gt; Flutter Hot Reload in a Flutter IDE). Notice that the
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// counter didn&#39;t reset back to zero; the application is not restarted.
</span><span style="color:#75715e"></span>        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: <span style="color:#e6db74">&#39;Flutter Demo Home Page&#39;</span>),
    );
  }
}

<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">MyHomePage</span> <span style="color:#66d9ef">extends</span> StatefulWidget {
  MyHomePage({Key key, <span style="color:#66d9ef">this</span>.title}) <span style="color:#f92672">:</span> <span style="color:#66d9ef">super</span>(key: key);

  <span style="color:#75715e">// This widget is the home page of your application. It is stateful, meaning
</span><span style="color:#75715e"></span>  <span style="color:#75715e">// that it has a State object (defined below) that contains fields that affect
</span><span style="color:#75715e"></span>  <span style="color:#75715e">// how it looks.
</span><span style="color:#75715e"></span>
  <span style="color:#75715e">// This class is the configuration for the state. It holds the values (in this
</span><span style="color:#75715e"></span>  <span style="color:#75715e">// case the title) provided by the parent (in this case the App widget) and
</span><span style="color:#75715e"></span>  <span style="color:#75715e">// used by the build method of the State. Fields in a Widget subclass are
</span><span style="color:#75715e"></span>  <span style="color:#75715e">// always marked &#34;final&#34;.
</span><span style="color:#75715e"></span>
  <span style="color:#66d9ef">final</span> <span style="color:#66d9ef">String</span> title;

  <span style="color:#960050;background-color:#1e0010">@</span>override
  _MyHomePageState createState() <span style="color:#f92672">=&gt;</span> _MyHomePageState();
}

<span style="color:#66d9ef">class</span> <span style="color:#a6e22e">_MyHomePageState</span> <span style="color:#66d9ef">extends</span> State<span style="color:#f92672">&lt;</span>MyHomePage<span style="color:#f92672">&gt;</span> {
  <span style="color:#66d9ef">int</span> _counter <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>;

  <span style="color:#66d9ef">void</span> _incrementCounter() {
    setState(() {
      <span style="color:#75715e">// This call to setState tells the Flutter framework that something has
</span><span style="color:#75715e"></span>      <span style="color:#75715e">// changed in this State, which causes it to rerun the build method below
</span><span style="color:#75715e"></span>      <span style="color:#75715e">// so that the display can reflect the updated values. If we changed
</span><span style="color:#75715e"></span>      <span style="color:#75715e">// _counter without calling setState(), then the build method would not be
</span><span style="color:#75715e"></span>      <span style="color:#75715e">// called again, and so nothing would appear to happen.
</span><span style="color:#75715e"></span>      _counter<span style="color:#f92672">++</span>;
    });
  }

  <span style="color:#960050;background-color:#1e0010">@</span>override
  Widget build(BuildContext context) {
    <span style="color:#75715e">// This method is rerun every time setState is called, for instance as done
</span><span style="color:#75715e"></span>    <span style="color:#75715e">// by the _incrementCounter method above.
</span><span style="color:#75715e"></span>    <span style="color:#75715e">//
</span><span style="color:#75715e"></span>    <span style="color:#75715e">// The Flutter framework has been optimized to make rerunning build methods
</span><span style="color:#75715e"></span>    <span style="color:#75715e">// fast, so that you can just rebuild anything that needs updating rather
</span><span style="color:#75715e"></span>    <span style="color:#75715e">// than having to individually change instances of widgets.
</span><span style="color:#75715e"></span>    <span style="color:#66d9ef">return</span> Scaffold(
      appBar: AppBar(
        <span style="color:#75715e">// Here we take the value from the MyHomePage object that was created by
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// the App.build method, and use it to set our appbar title.
</span><span style="color:#75715e"></span>        title: Text(widget.title),
      ),
      body: Center(
        <span style="color:#75715e">// Center is a layout widget. It takes a single child and positions it
</span><span style="color:#75715e"></span>        <span style="color:#75715e">// in the middle of the parent.
</span><span style="color:#75715e"></span>        child: Column(
          <span style="color:#75715e">// Column is also layout widget. It takes a list of children and
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// arranges them vertically. By default, it sizes itself to fit its
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// children horizontally, and tries to be as tall as its parent.
</span><span style="color:#75715e"></span>          <span style="color:#75715e">//
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// Invoke &#34;debug painting&#34; (press &#34;p&#34; in the console, choose the
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// &#34;Toggle Debug Paint&#34; action from the Flutter Inspector in Android
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// Studio, or the &#34;Toggle Debug Paint&#34; command in Visual Studio Code)
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// to see the wireframe for each widget.
</span><span style="color:#75715e"></span>          <span style="color:#75715e">//
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// Column has various properties to control how it sizes itself and
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// how it positions its children. Here we use mainAxisAlignment to
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// center the children vertically; the main axis here is the vertical
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// axis because Columns are vertical (the cross axis would be
</span><span style="color:#75715e"></span>          <span style="color:#75715e">// horizontal).
</span><span style="color:#75715e"></span>          mainAxisAlignment: MainAxisAlignment.center,
          children: <span style="color:#f92672">&lt;</span>Widget<span style="color:#f92672">&gt;</span>[
            Text(
              <span style="color:#e6db74">&#39;You have pushed the button this many times:&#39;</span>,
            ),
            Text(
              <span style="color:#e6db74">&#39;</span><span style="color:#e6db74">$</span>_counter<span style="color:#e6db74">&#39;</span>,
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: <span style="color:#e6db74">&#39;Increment&#39;</span>,
        child: Icon(Icons.add),
      ), <span style="color:#75715e">// This trailing comma makes auto-formatting nicer for build methods.
</span><span style="color:#75715e"></span>    );
  }
}
</code></pre></div><h2 id="运行">运行</h2>
<h3 id="运行-flutter-工程">运行 flutter 工程</h3>
<p>这里要注意,我这里在 flutter 下直接运行会得到下面的结果, 所以你需要自己在 debug 的情况下指定一个路由</p>
<p>修改 main.dart 中的 main 方法为如下结果</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-dart" data-lang="dart"><span style="color:#66d9ef">void</span> main() {
  <span style="color:#66d9ef">var</span> routeName <span style="color:#f92672">=</span> ui.window.defaultRouteName;
  routeName <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;route1&#34;</span>; <span style="color:#75715e">// 新增这一行
</span><span style="color:#75715e"></span>  <span style="color:#66d9ef">switch</span> (routeName) {
    <span style="color:#66d9ef">case</span> <span style="color:#e6db74">&#34;route1&#34;</span><span style="color:#f92672">:</span>
      runApp(MyApp());
      <span style="color:#66d9ef">break</span>;
    <span style="color:#66d9ef">default</span><span style="color:#f92672">:</span>
      runApp(EmptyWidget());
  }
}
</code></pre></div><p>正式运行的时候一定要注释掉,如果不注释掉, 原生工程中的那个 route1 就失效了</p>
<p>然后运行下</p>
<p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2Fdevice-2019-01-22-093059.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="img"></p>
<p>看起来和默认的 hello world 工程是一样的</p>
<h3 id="运行原生工程">运行原生工程</h3>
<p>为什么看起来是一样的呢,flutter run 默认运行的是当前目录下的 lib/main.dart, 然后找 main 方法, main 方法中就是 runApp,所以看起来就是这样的了</p>
<p>但我们需要的是将 flutter 加入到原生工程中去,那么我们就需要在原生工程里面去运行这个项目</p>
<p>我们直接在 android studio 中运行项目,可能会得到下面的结果,也可能没有 这个应该和你 android 中的 min sdk /target sdk 版本有关系,有原生经验的人</p>
<p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190122085942.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190122085942.png"></p>
<p>拿着错误信息随手一百度能看到一个<a href="https://blog.csdn.net/zzh_receive/article/details/81168500">连接</a></p>
<p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2F20190122094535.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="20190122094535.png"></p>
<p>ok 我们在 android 项目中加入这个, 这个意思就是指定 java 的版本为 1.8(java 8)</p>
<p>修改 gradle 文件</p>
<p>app 下的 build.gradle</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-groovy" data-lang="groovy">android<span style="color:#f92672">{</span>
    compileOptions <span style="color:#f92672">{</span>
        sourceCompatibility JavaVersion<span style="color:#f92672">.</span><span style="color:#a6e22e">VERSION_1_8</span>
        targetCompatibility JavaVersion<span style="color:#f92672">.</span><span style="color:#a6e22e">VERSION_1_8</span>
    <span style="color:#f92672">}</span>
<span style="color:#f92672">}</span>
</code></pre></div><p>接着就可以跑起来项目了</p>
<p><img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2Fdevice-2019-01-22-095010.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="img"></p>
<p>点击按钮
<img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2Fdevice-2019-01-22-095023.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="i"></p>
<h2 id="微调一下">微调一下</h2>
<p>我们看到 flutter 界面上会比较怪, 这是因为原生和 flutter 主题色不一样的原因</p>
<p>修改原生的主题色
colors.xml</p>
<div class="highlight"><pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-xml" data-lang="xml"><span style="color:#75715e">&lt;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&gt;</span>
<span style="color:#f92672">&lt;resources&gt;</span>
    <span style="color:#f92672">&lt;color</span> <span style="color:#a6e22e">name=</span><span style="color:#e6db74">&#34;colorPrimary&#34;</span><span style="color:#f92672">&gt;</span>#2196F3<span style="color:#f92672">&lt;/color&gt;</span>
    <span style="color:#f92672">&lt;color</span> <span style="color:#a6e22e">name=</span><span style="color:#e6db74">&#34;colorPrimaryDark&#34;</span><span style="color:#f92672">&gt;</span>#19639e<span style="color:#f92672">&lt;/color&gt;</span>
    <span style="color:#f92672">&lt;color</span> <span style="color:#a6e22e">name=</span><span style="color:#e6db74">&#34;colorAccent&#34;</span><span style="color:#f92672">&gt;</span>#D81B60<span style="color:#f92672">&lt;/color&gt;</span>
<span style="color:#f92672">&lt;/resources&gt;</span>

</code></pre></div><p>再打开原生项目可以看到颜色发生了变化
<img src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&amp;path=%2Fdevice-2019-01-22-100056.png&amp;versionDescriptor%5BversionOptions%5D=0&amp;versionDescriptor%5BversionType%5D=0&amp;resolveLfs=true&amp;%24format=octetStream&amp;api-version=5.0" alt="img"></p>
<h2 id="后记">后记</h2>
<p>简单的添加 flutter 到 android 就完成了,当然在具体实施中还会有很多问题,只能在具体情况具体分析了</p>
<p>如果遇到问题,欢迎在后面留言</p>
<p>另外,如果遇到了本篇和 wiki 不同的情况,请以 wiki 为准,毕竟官方 wiki 的更新会比较频繁,就在我写这篇文章的时候,还在间隔几天更新一次</p>

                        </div>

                        

<div class="post-archive">
    <h2>See Also</h2>
    <ul class="listing">
        
        <li><a href="/posts/flutter/android/finish-activity/">Finish FlutterActivity 源码解析</a></li>
        
        <li><a href="/posts/flutter/channel/flutter-channel2/">Flutter 原生通信 (二) - Android通知Flutter</a></li>
        
        <li><a href="/posts/flutter/channel/flutter-channel1/">Flutter 原生通信 (一) - flutter调用Android</a></li>
        
        <li><a href="/posts/flutter/so-about-1/">flutter android So库对齐</a></li>
        
        <li><a href="/posts/android/android-include-ffmpeg/">android 引入ffmpeg</a></li>
        
    </ul>
</div>


                        <div class="post-meta meta-tags">
                            
                            <ul class="clearfix">
                                
                                <li><a href="http://www.kikt.top/tags/flutter">flutter</a></li>
                                
                                <li><a href="http://www.kikt.top/tags/android">android</a></li>
                                
                                <li><a href="http://www.kikt.top/tags/exists">exists</a></li>
                                
                            </ul>
                            
                        </div>
                    </article>
                    
    

    
    
    <div class="post bg-white">
      <script src="https://utteranc.es/client.js"
            repo= "caijinglong/kikt-blog-comment"
            issue-term="pathname"
            theme="github-light"
            crossorigin="anonymous"
            async>
      </script>
    </div>
    
                </div>
            </div>
            <div id="secondary">
    <section class="widget">
        <form id="search" action="//www.google.com/search" method="get" accept-charset="utf-8" target="_blank" _lpchecked="1">
      
      <input type="text" name="q" maxlength="20" placeholder="Search">
      <input type="hidden" name="sitesearch" value="http://www.kikt.top">
      <button type="submit" class="submit icon-search"></button>
</form>
    </section>
    
    <section class="widget">
        <h3 class="widget-title">最近文章</h3>
<ul class="widget-list">
    
    <li>
        <a href="http://www.kikt.top/posts/java/crack/crack1/" title="使用javassist,修改jar包方法实现">使用javassist,修改jar包方法实现</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/github/actions/create/" title="Github action 的开发到发布">Github action 的开发到发布</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/jenkins&#43;fastlane/" title="flutter Jenkins&#43;fastlane 自动化打测试包, 并上传蒲公英">flutter Jenkins&#43;fastlane 自动化打测试包, 并上传蒲公英</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/go/compile-for-android/" title="编译 go 源码为 android 动态库(so)">编译 go 源码为 android 动态库(so)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/focusnode-2/" title="Flutter FocusNode 焦点那点事-(二)">Flutter FocusNode 焦点那点事-(二)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/focusnode-1/" title="Flutter FocusNode 焦点那点事-(一)">Flutter FocusNode 焦点那点事-(一)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/server/caddy/cros_for_local_dev/" title="用 Caddy 解决 web 开发中本地跨域的问题">用 Caddy 解决 web 开发中本地跨域的问题</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/route/navigator-helper2/" title="Navigator Helper2">Navigator Helper2</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/grey-app/" title="flutter 怎么实现app整体灰度">flutter 怎么实现app整体灰度</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/posts/flutter/plugin/flutter-sdk-import-aar/" title="Flutter 插件开发之引入aar到安卓部分 并使用本地maven">Flutter 插件开发之引入aar到安卓部分 并使用本地maven</a>
    </li>
    
</ul>
    </section>

    

    <section class="widget">
        <h3 class="widget-title">分类</h3>
<ul class="widget-list">
    
    <li>
        <a href="http://www.kikt.top/categories/android/">android(25)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/caddy/">caddy(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/dart/">dart(5)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/docker/">docker(3)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/flutter/">flutter(60)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/github/">github(3)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/go/">go(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/golang/">golang(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/iOS/">iOS(6)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/ios/">ios(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/java/">java(6)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/jetbrains/">jetbrains(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/other/">other(3)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/python/">python(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/server/">server(5)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/spring/">spring(3)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/tools/">tools(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/%E6%9D%82%E9%A1%B9/">杂项(1)</a>
    </li>
    
    <li>
        <a href="http://www.kikt.top/categories/%E6%B6%82%E9%B8%A6/">涂鸦(1)</a>
    </li>
    
</ul>
    </section>

    <section class="widget">
        <h3 class="widget-title">标签</h3>
<div class="tagcloud">
    
    <a href="http://www.kikt.top/tags/10/">10</a>
    
    <a href="http://www.kikt.top/tags/2.3/">2.3</a>
    
    <a href="http://www.kikt.top/tags/Clipboard/">Clipboard</a>
    
    <a href="http://www.kikt.top/tags/Javassist/">Javassist</a>
    
    <a href="http://www.kikt.top/tags/Migrate/">Migrate</a>
    
    <a href="http://www.kikt.top/tags/aar/">aar</a>
    
    <a href="http://www.kikt.top/tags/actions/">actions</a>
    
    <a href="http://www.kikt.top/tags/aidl/">aidl</a>
    
    <a href="http://www.kikt.top/tags/android/">android</a>
    
    <a href="http://www.kikt.top/tags/androidQ/">androidQ</a>
    
    <a href="http://www.kikt.top/tags/androidX/">androidX</a>
    
    <a href="http://www.kikt.top/tags/apk/">apk</a>
    
    <a href="http://www.kikt.top/tags/app/">app</a>
    
    <a href="http://www.kikt.top/tags/appcode/">appcode</a>
    
    <a href="http://www.kikt.top/tags/azure/">azure</a>
    
    <a href="http://www.kikt.top/tags/ble/">ble</a>
    
    <a href="http://www.kikt.top/tags/bottomsheet/">bottomsheet</a>
    
    <a href="http://www.kikt.top/tags/butterknife/">butterknife</a>
    
    <a href="http://www.kikt.top/tags/c/">c</a>
    
    <a href="http://www.kikt.top/tags/caddy/">caddy</a>
    
    <a href="http://www.kikt.top/tags/camera/">camera</a>
    
    <a href="http://www.kikt.top/tags/cameraX/">cameraX</a>
    
    <a href="http://www.kikt.top/tags/channel/">channel</a>
    
    <a href="http://www.kikt.top/tags/cocoapods/">cocoapods</a>
    
    <a href="http://www.kikt.top/tags/cupertino/">cupertino</a>
    
    <a href="http://www.kikt.top/tags/dart/">dart</a>
    
    <a href="http://www.kikt.top/tags/dart-2.6/">dart-2.6</a>
    
    <a href="http://www.kikt.top/tags/desktop/">desktop</a>
    
    <a href="http://www.kikt.top/tags/dialog/">dialog</a>
    
    <a href="http://www.kikt.top/tags/dmg/">dmg</a>
    
    <a href="http://www.kikt.top/tags/doc/">doc</a>
    
    <a href="http://www.kikt.top/tags/docker/">docker</a>
    
    <a href="http://www.kikt.top/tags/docker-compose/">docker-compose</a>
    
    <a href="http://www.kikt.top/tags/excel/">excel</a>
    
    <a href="http://www.kikt.top/tags/exists/">exists</a>
    
    <a href="http://www.kikt.top/tags/faq/">faq</a>
    
    <a href="http://www.kikt.top/tags/fastlane/">fastlane</a>
    
    <a href="http://www.kikt.top/tags/ffi/">ffi</a>
    
    <a href="http://www.kikt.top/tags/ffmpeg/">ffmpeg</a>
    
    <a href="http://www.kikt.top/tags/flexmark/">flexmark</a>
    
    <a href="http://www.kikt.top/tags/flutter/">flutter</a>
    
    <a href="http://www.kikt.top/tags/flutter-web/">flutter-web</a>
    
    <a href="http://www.kikt.top/tags/focus/">focus</a>
    
    <a href="http://www.kikt.top/tags/focusNode/">focusNode</a>
    
    <a href="http://www.kikt.top/tags/form/">form</a>
    
    <a href="http://www.kikt.top/tags/framework/">framework</a>
    
    <a href="http://www.kikt.top/tags/github/">github</a>
    
    <a href="http://www.kikt.top/tags/go/">go</a>
    
    <a href="http://www.kikt.top/tags/golang/">golang</a>
    
    <a href="http://www.kikt.top/tags/gradle/">gradle</a>
    
    <a href="http://www.kikt.top/tags/http/">http</a>
    
    <a href="http://www.kikt.top/tags/iOS/">iOS</a>
    
    <a href="http://www.kikt.top/tags/ide/">ide</a>
    
    <a href="http://www.kikt.top/tags/idea/">idea</a>
    
    <a href="http://www.kikt.top/tags/index/">index</a>
    
    <a href="http://www.kikt.top/tags/inside/">inside</a>
    
    <a href="http://www.kikt.top/tags/ios/">ios</a>
    
    <a href="http://www.kikt.top/tags/java/">java</a>
    
    <a href="http://www.kikt.top/tags/jenkins/">jenkins</a>
    
    <a href="http://www.kikt.top/tags/jetbrains/">jetbrains</a>
    
    <a href="http://www.kikt.top/tags/jsdelivr/">jsdelivr</a>
    
    <a href="http://www.kikt.top/tags/json/">json</a>
    
    <a href="http://www.kikt.top/tags/json_serializable/">json_serializable</a>
    
    <a href="http://www.kikt.top/tags/junit/">junit</a>
    
    <a href="http://www.kikt.top/tags/library/">library</a>
    
    <a href="http://www.kikt.top/tags/live-template/">live-template</a>
    
    <a href="http://www.kikt.top/tags/loadmore/">loadmore</a>
    
    <a href="http://www.kikt.top/tags/log/">log</a>
    
    <a href="http://www.kikt.top/tags/mac/">mac</a>
    
    <a href="http://www.kikt.top/tags/macos/">macos</a>
    
    <a href="http://www.kikt.top/tags/maven/">maven</a>
    
    <a href="http://www.kikt.top/tags/mysql/">mysql</a>
    
    <a href="http://www.kikt.top/tags/navigationbar/">navigationbar</a>
    
    <a href="http://www.kikt.top/tags/navigator/">navigator</a>
    
    <a href="http://www.kikt.top/tags/ndk/">ndk</a>
    
    <a href="http://www.kikt.top/tags/nginx/">nginx</a>
    
    <a href="http://www.kikt.top/tags/oc/">oc</a>
    
    <a href="http://www.kikt.top/tags/opencv/">opencv</a>
    
    <a href="http://www.kikt.top/tags/poi/">poi</a>
    
    <a href="http://www.kikt.top/tags/pub/">pub</a>
    
    <a href="http://www.kikt.top/tags/python/">python</a>
    
    <a href="http://www.kikt.top/tags/retrofit/">retrofit</a>
    
    <a href="http://www.kikt.top/tags/route/">route</a>
    
    <a href="http://www.kikt.top/tags/server/">server</a>
    
    <a href="http://www.kikt.top/tags/so/">so</a>
    
    <a href="http://www.kikt.top/tags/spp/">spp</a>
    
    <a href="http://www.kikt.top/tags/sprintboot/">sprintboot</a>
    
    <a href="http://www.kikt.top/tags/swift/">swift</a>
    
    <a href="http://www.kikt.top/tags/tap/">tap</a>
    
    <a href="http://www.kikt.top/tags/thymeleaf/">thymeleaf</a>
    
    <a href="http://www.kikt.top/tags/tips/">tips</a>
    
    <a href="http://www.kikt.top/tags/toast/">toast</a>
    
    <a href="http://www.kikt.top/tags/transition/">transition</a>
    
    <a href="http://www.kikt.top/tags/ui/">ui</a>
    
    <a href="http://www.kikt.top/tags/utf8/">utf8</a>
    
    <a href="http://www.kikt.top/tags/yield/">yield</a>
    
    <a href="http://www.kikt.top/tags/%E4%BA%8C%E8%BF%9B%E5%88%B6/">二进制</a>
    
    <a href="http://www.kikt.top/tags/%E4%BA%A4%E5%8F%89/">交叉</a>
    
    <a href="http://www.kikt.top/tags/%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91/">交叉编译</a>
    
    <a href="http://www.kikt.top/tags/%E4%BB%8B%E7%BB%8D/">介绍</a>
    
    <a href="http://www.kikt.top/tags/%E4%BB%A3%E7%A0%81%E8%A7%84%E8%8C%83/">代码规范</a>
    
    <a href="http://www.kikt.top/tags/%E5%86%B2%E7%AA%81/">冲突</a>
    
    <a href="http://www.kikt.top/tags/%E5%8A%A8%E6%80%81/">动态</a>
    
    <a href="http://www.kikt.top/tags/%E5%8F%91%E5%B8%83/">发布</a>
    
    <a href="http://www.kikt.top/tags/%E5%8F%AF%E6%89%A7%E8%A1%8C/">可执行</a>
    
    <a href="http://www.kikt.top/tags/%E5%9B%BE%E5%BA%8A/">图床</a>
    
    <a href="http://www.kikt.top/tags/%E5%9F%8E%E5%B8%82/">城市</a>
    
    <a href="http://www.kikt.top/tags/%E5%A4%A7%E6%96%87%E4%BB%B6/">大文件</a>
    
    <a href="http://www.kikt.top/tags/%E5%B7%A5%E5%85%B7/">工具</a>
    
    <a href="http://www.kikt.top/tags/%E5%B7%B2%E6%9C%89%E9%A1%B9%E7%9B%AE/">已有项目</a>
    
    <a href="http://www.kikt.top/tags/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83/">开发环境</a>
    
    <a href="http://www.kikt.top/tags/%E6%80%BB%E7%BB%93/">总结</a>
    
    <a href="http://www.kikt.top/tags/%E6%85%A2/">慢</a>
    
    <a href="http://www.kikt.top/tags/%E6%89%93%E5%8C%85/">打包</a>
    
    <a href="http://www.kikt.top/tags/%E6%89%AB%E7%A0%81/">扫码</a>
    
    <a href="http://www.kikt.top/tags/%E6%8F%92%E4%BB%B6/">插件</a>
    
    <a href="http://www.kikt.top/tags/%E6%96%87%E6%A1%A3/">文档</a>
    
    <a href="http://www.kikt.top/tags/%E6%A8%A1%E6%9D%BF/">模板</a>
    
    <a href="http://www.kikt.top/tags/%E6%B8%B2%E6%9F%93/">渲染</a>
    
    <a href="http://www.kikt.top/tags/%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/">源码解析</a>
    
    <a href="http://www.kikt.top/tags/%E7%81%B0%E5%BA%A6/">灰度</a>
    
    <a href="http://www.kikt.top/tags/%E7%82%B9%E5%87%BB/">点击</a>
    
    <a href="http://www.kikt.top/tags/%E7%84%A6%E7%82%B9/">焦点</a>
    
    <a href="http://www.kikt.top/tags/%E7%88%AC%E8%99%AB/">爬虫</a>
    
    <a href="http://www.kikt.top/tags/%E7%8A%B6%E6%80%81%E7%AE%A1%E7%90%86/">状态管理</a>
    
    <a href="http://www.kikt.top/tags/%E7%99%BE%E5%BA%A6%E5%9C%B0%E5%9B%BE/">百度地图</a>
    
    <a href="http://www.kikt.top/tags/%E7%BC%96%E7%A0%81/">编码</a>
    
    <a href="http://www.kikt.top/tags/%E7%BC%96%E7%A8%8B%E6%8A%80%E5%B7%A7/">编程技巧</a>
    
    <a href="http://www.kikt.top/tags/%E7%BC%96%E8%AF%91/">编译</a>
    
    <a href="http://www.kikt.top/tags/%E7%BF%BB%E8%AF%91/">翻译</a>
    
    <a href="http://www.kikt.top/tags/%E8%93%9D%E7%89%99/">蓝牙</a>
    
    <a href="http://www.kikt.top/tags/%E8%A1%A8%E5%8D%95/">表单</a>
    
    <a href="http://www.kikt.top/tags/%E8%B7%AF%E7%94%B1/">路由</a>
    
    <a href="http://www.kikt.top/tags/%E8%BF%87%E5%9C%BA%E5%8A%A8%E7%94%BB/">过场动画</a>
    
    <a href="http://www.kikt.top/tags/%E9%9A%90%E7%A7%81/">隐私</a>
    
</div>
    </section>

    
<section class="widget">
    <h3 class="widget-title">友情链接</h3>
    <ul class="widget-list">
        
        <li>
            <a target="_blank" href="https://github.com/Caijinglong" title="我的Github">我的Github</a>
        </li>
        
        <li>
            <a target="_blank" href="https://flutter.dev" title="flutter 官网">flutter 官网</a>
        </li>
        
    </ul>
</section>


    <section class="widget">
        <h3 class="widget-title">其它</h3>
        <ul class="widget-list">
            <li><a href="http://www.kikt.top/index.xml">文章 RSS</a></li>
        </ul>
    </section>
</div>
        </div>
    </div>
</div>
<footer id="footer">
    <div class="container">
        <div>
            <p>如果我的blog对您有帮助,而您愿意捐赠 😆, 可以用下面的二维码</p>
            <img style="width:5rem;" src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=0&resolveLfs=true&%24format=octetStream&api-version=5.0&path=%2F20190424141834.png"/>
            <img style="width:5rem; padding-left: 2rem;" 
            src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=0&resolveLfs=true&%24format=octetStream&api-version=5.0&path=%2F20190424141931.png"/>
            <img style="width:5rem; padding-left: 2rem;" 
            src="https://dev.azure.com/cjlspy/844861b8-ee45-48a3-b430-b974684baaaa/_apis/git/repositories/bf4da1c1-1cfa-4f54-8a75-745cce2b737c/items?versionDescriptor%5Bversion%5D=master&versionDescriptor%5BversionOptions%5D=0&versionDescriptor%5BversionType%5D=0&resolveLfs=true&%24format=octetStream&api-version=5.0&path=%2F20190424142013.png"/>
        </div>
        &copy; 2018 <a href="http://www.kikt.top">caijinglong的博客 By caijinglong</a>.
        Powered by <a rel="nofollow noreferer noopener" href="https://gohugo.io" target="_blank">Hugo</a>.
        <a href="http://www.flysnow.org/" target="_blank">Theme</a> based on <a href="https://github.com/rujews/maupassant-hugo" target="_blank">maupassant</a>.<br/>
        本站所有内容基于<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" style="color:coral">CC4.0</a>协议发布,需要转载必须署名
        <br/>
        如果有问题可以<a href="mailto:cjl_spy@163.com">email联系我</a>
        <br/>
        京ICP备18038473号-1
        
    </div>
</footer>


    <script type="text/javascript" src="/js/prism.js" async="true"></script>
    <script type="text/javascript">
    
    (function(){
        $("pre code").parent().addClass("line-numbers")
    }())

    window.MathJax = {
        tex2jax: {
            inlineMath: [ ['$','$'] ],
            processEscapes: true
        }
    };
    </script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML' async></script>

<a id="rocket" href="#top"></a>
<script type="text/javascript" src="/js/totop.js?v=0.0.0" async=""></script>



<script type="text/javascript" src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" async></script>




</body>
</html>
